/************************************************************************/
/* Actor is the base class of all Actor, and CompositeActor.             */
/* Every actor is running as a thread in the same process space with    */
/*   the scientific workflow engine.                                    */
/* The Scientific Workflow Engine is a coordinator which communicate    */
/*   with all applications and actors in them.                          */
/*   It can be called APnModel Engine.                                  */ 
/************************************************************************/
#ifndef ACTOR_H
#define ACTOR_H

#include <QtCore/QThread>
#include "Pool.h"
#include "Port.h"
class QStringList;

class Actor : public QThread
{
	Q_OBJECT

public:
	Actor(QObject *parent);
	~Actor();

	enum RunState{ Running, Enabled, Sleep };
	
	bool enabled();
	bool error();

	//service for persistence of the run-time application
	virtual bool storeState();
	virtual bool restoreState();

protected:
	void run();

private:
	//two types of token: one for continuous run, the other for step one
	//provided by engine, it can be shared by all actors,
	//or each actor has one.
	Pool* enablePool; 
	Pool* errorPool;
};

#endif // ACTOR_H
